import { Component, OnInit } from '@angular/core';
import { Singlon } from '../../models/Singlon'

@Component({
    selector: 'test-component',
    template: ``
})
export class TestComponent implements OnInit {
    constructor() { }

    ngOnInit() {
        const p1 = new Person(2);
        const p2 = new Person(1);

        console.log('p1 > p2? ', p1 > p2);

        console.log('----------------');

        const s1 = Singlon.getInstance();
        const s2 = Singlon.getInstance();

        console.log('s1=s2: ', s1===s2);
        
    }
}

class Person {
    public age: number;

    constructor (age: number) {
        this.age = age;
    }

    valueOf () {
        return this.age;
    }
}